home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / JS_MATH_ / JS_GENER.H next >
Text File  |  1990-11-21  |  7KB  |  181 lines

  1. /* CONSTANTS */
  2.  
  3. #define JS_PI                     3.14159265358979
  4. #define JS_TwoPI                 6.28318530717959
  5. #define JS_TRUE                 1
  6. #define JS_FALSE                 0
  7. #define JS_SUPPRESS                0
  8. #define JS_NO_SUPPRESS            1
  9.  
  10. #define JS_FATAL_ERROR            "\pA fatal error has occurred.  Control returned to the Finder."
  11. #define JS_ERROR_ALERT_ID        500
  12.  
  13. #define JS_NIL_STRING            "\p"
  14. #define JS_NIL_POINTER            0L
  15. #define JS_MOVE_TO_FRONT        -1
  16.  
  17. #define JS_COMPLETE_DIALOG        18001
  18. #define JS_COMPLETE_TEXT        1
  19. #define JS_COMPLETE_TITLE        2
  20.  
  21. #define JS_STD_HIGHLIGHT        1
  22. #define JS_CONE_HEIGHT            0
  23. #define JS_CONE_LENGTH            1
  24. #define JS_FRUSTUM_HEIGHT        0
  25. #define JS_FRUSTUM_LENGTH        1
  26. #define JS_BEGIN                -1
  27. #define JS_ALL                    0
  28. #define JS_END                    1
  29.  
  30.  
  31. /* MACROS */
  32.  
  33. #define        JS_MIN(a,b)            (((a) < (b)) ? (a) : (b))
  34. #define        JS_MAX(a,b)            (((a) > (b)) ? (a) : (b))
  35. #define        JS_SQUARE(x)        ((x) * (x))
  36. #define        JS_CUBE(x)            ((x) * (x) * (x))
  37. #ifdef _H_stdlib
  38. #define        JS_RANDOM(x)        (rand() % ((x) + 1))
  39. #define        JS_RANDOM_2(a,b)    (rand() % ((b) - (a) + 1) + (a))
  40. #endif
  41.  
  42.  
  43. /* STRUCTURES */
  44.  
  45. typedef struct JS_Complex
  46. {
  47.     double re;
  48.     double im;
  49. } JS_Complex;
  50.  
  51.  
  52. /* PROTOTYPES */
  53.  
  54. JS_Complex             JS_Complex_Add( JS_Complex, JS_Complex );
  55. JS_Complex             JS_Complex_Sub( JS_Complex, JS_Complex );
  56. JS_Complex             JS_Complex_Mult( JS_Complex, JS_Complex );
  57. JS_Complex             JS_Complex_Div( JS_Complex, JS_Complex );
  58. JS_Complex             JS_Complex_Num( double, double );
  59. double                 JS_Complex_Abs( JS_Complex );
  60. JS_Complex             JS_Complex_Conjugate( JS_Complex );
  61. JS_Complex             JS_Complex_Sqrt( JS_Complex );
  62. JS_Complex             JS_Double_Complex_Mult( double, JS_Complex );
  63. JS_Complex             JS_Complex_Exp( JS_Complex );
  64.  
  65. void                 JS_Fatal_Error_Handler(char *);
  66. void                JS_Error_Handler(char *);
  67. long                 JS_Get_Dialog_Long( DialogPtr, int, long );
  68. void                 JS_Put_Dialog_Long( DialogPtr, int, long, char );
  69. double                 JS_Get_Dialog_Double( DialogPtr, int, double );
  70. void                 JS_Put_Dialog_Double( DialogPtr, int, double, char );
  71. int                 JS_Get_Dialog_Integer( DialogPtr, int, int );
  72. void                 JS_Put_Dialog_Integer( DialogPtr, int, int, char );
  73. float                 JS_Get_Dialog_Float( DialogPtr, int, float );
  74. void                 JS_Put_Dialog_Float( DialogPtr, int, float, char );
  75. char *                 JS_Get_Dialog_Text( DialogPtr, int, char * );
  76. void                 JS_Put_Dialog_Text( DialogPtr, int, char *, char );
  77. void                 JS_Do_Binary_Control( DialogPtr, int );
  78. void                 JS_Center_Alerts( AlertTHndl );
  79. void                 JS_Current_Device_Size( int *, int * );
  80. void                 JS_Center_Window (WindowPtr);
  81. void                 JS_Highlight_Button (DialogPtr, int);
  82.  
  83. double                 JS_Triangle_Area_BH( double, double );
  84. double                 JS_Triangle_Area_BCA( double, double, double );
  85. double                JS_Deg_to_Rad( double );
  86. double                JS_Rad_to_Deg( double );
  87. double                JS_Trapazoid_Area( double, double, double );
  88. double                 JS_Circle_Area( double );
  89. double                 JS_Circle_Circumference( double );
  90. double                 JS_Circle_Sector_Length( double, double );
  91. double                 JS_Circle_Sector_Area( double, double );
  92. double                 JS_Prism_Volume_Bh( double, double );
  93. double                 JS_Prism_Volume_ABC( double, double, double );
  94. double                 JS_Cylinder_Volume( double, double );
  95. double                JS_Cylinder_Lateral_SA( double, double );
  96. double                 JS_Cylinder_Total_SA( double, double );
  97. double                 JS_Pyramid_Volume( double, double );
  98. double                JS_Cone_Volume( double, double, short );
  99. double                 JS_Cone_Lateral_SA( double, double, short );
  100. double                 JS_Cone_Total_SA( double, double, short );
  101. double                 JS_Frustum_Cone_Volume( double, double, double, short );
  102. double                 JS_Frustum_Cone_LSA( double, double, double, short );
  103. double                 JS_Frustum_Cone_TSA( double, double, double, short );
  104. double                 JS_Sphere_Volume( double );
  105. double                 JS_Sphere_SA( double );
  106.  
  107. void                 JS_Add_Vectors_No_Destroy( double *, double *, double *, short, short, short );
  108. void                 JS_Add_Vectors( double *, double *, short, short, short );
  109. double                 JS_Vector_Magnitude( double *, short, short );
  110. void                 JS_Normalize_Vector( double *, short, short );
  111. char                 JS_Vector_Compare( double *, double *, short, short, double );
  112. void                JS_Add_Matrices( double **, double **, short, short, short, short, short );
  113. void                JS_Add_Matrices_No_Destroy( double **, double **, double **, short, short, short, short, short );
  114. void                 JS_Multiply_Matrices( double **, double **, double **, short, short, short, short );
  115. char                 JS_Handle_Eigenvalue( double **, int, double *, char );
  116. double                 JS_Matrix_Determinant( double **, int );
  117. void                 JS_Matrix_Inverse( double **, double **, int );
  118. void                 JS_Solve_Linear_System( double **, double *, int );
  119. void                 JS_Matrix_Transpose( double **, int );
  120.  
  121. float *                JS_Float_Vector( long, long, char );
  122. char *                JS_Char_Vector( long, long, char );
  123. int *                JS_Int_Vector( long, long, char );
  124. long *                JS_Long_Vector( long, long, char );
  125. double *            JS_Double_Vector( long, long, char );
  126. void                 JS_Free_Float_Vector( float *, long, long );
  127. void                 JS_Free_Int_Vector( int *, long, long );
  128. void                 JS_Free_Long_Vector( long *, long, long );
  129. void                 JS_Free_Double_Vector( double *, long, long );
  130. void                 JS_Free_Char_Vector( char *, long, long );
  131. float **            JS_Float_Matrix( long, long, long, long, char );
  132. double **            JS_Double_Matrix( long, long, long, long, char );
  133. int **                JS_Int_Matrix( long, long, long, long, char );
  134. long **                JS_Long_Matrix( long, long, long, long, char );
  135. char **                JS_Char_Matrix( long, long, long, long, char );
  136. void                 JS_Free_Float_Matrix( float **, long, long, long, long );
  137. void                 JS_Free_Double_Matrix( double **, long, long, long, long );
  138. void                 JS_Free_Int_Matrix( int **, long, long, long, long );
  139. void                 JS_Free_Long_Matrix( long **, long, long, long, long );
  140. void                 JS_Free_Char_Matrix( char **, long, long, long, long );
  141.  
  142. void                 JS_Array_Find_Float(float *, int, float, int *);
  143. void                 JS_Array_Find_Double(double *, int, double, int *);
  144. void                 JS_Array_Find_Int(int *, int, int, int *);
  145. void                 JS_Array_Find_Long(long *, int, long, int *);
  146.  
  147. void                 JS_Heap_Sort_Double( double *, int );
  148. void                 JS_Heap_Sort_Float( float *, int );
  149. void                 JS_Heap_Sort_Integer( int *, int );
  150. void                 JS_Heap_Sort_Long( long *, int );
  151. void                 JS_Index_Double_Array( int, double *, int * );
  152. void                 JS_Index_Float_Array( int, float *, int * );
  153. void                 JS_Index_Integer_Array( int, int *, int * );
  154. void                 JS_Index_Long_Array( int, long *, int * );
  155. void                 JS_Quick_Sort_Int( int *, int );
  156. void                 JS_Quick_Sort_Float( float *, int );
  157. void                 JS_Quick_Sort_Double( double *, int );
  158. void                 JS_Quick_Sort_Long( long *, int );
  159. void                 JS_Alphabetize( char **, int, int );
  160.  
  161. void                JS_Char_Strip( char *, char, short );
  162. void                 JS_String_Strip( char *, char * );
  163. void                 JS_String_Insert( char *, char *, short );
  164.  
  165. double                 JS_Sign( double, double );
  166. double                 JS_Max( double, double );
  167. double                 JS_Min( double, double );
  168. double                 JS_Mod( double, double );
  169. double                JS_Min_Array( double *, int );
  170. double                JS_Max_Array( double *, int );
  171. double                JS_Square( double );
  172. double                JS_Cube( double );
  173. double                JS_General_Log( long, double );
  174. void                 JS_Pop_Sci_Notation( double, double *, long * );
  175. void                JS_Push_Sci_Notation( double, long, double * );
  176.  
  177. char                 JS_Check_Command_Period( EventRecord * );
  178. void                 JS_Init_Scale_Dialog( DialogPtr, char );
  179. void                 JS_Update_Scale_Dialog( DialogPtr, long, long );
  180. void                 JS_Kill_Scale_Dialog( DialogPtr );
  181.